using System;
using System.Collections.Generic;
using System.Text;
using Wrath.Xml.Objects.Controls;

namespace Wrath.Xml.Objects
{
    public class SheetData : IElementContainer
    {
        private List<WindowControl> controls = new List<WindowControl>();
        public List<WindowControl> Controls { get { return controls; } }

        public SheetData(Element element)
        {
            sourceElement = element;

            foreach (Element child in sourceElement.ChildElements)
            {
                WindowControl control = null;

                if (child.Name.ToLower() == "genericcontrol")
                {
                    control = new GenericControl(child);
                }

                if (control != null)
                {
                    controls.Add(control);
                }
            }
        }

        #region IElementContainer Members

        private Element sourceElement;
        public Element SourceElement
        {
            get { return sourceElement; }
        }

        public void Commit()
        {
            sourceElement = new Element("sheetdata");

        }

        #endregion
    }
}
